package string_test;

import java.util.Arrays;

public class StringSplit {
    public static void main(String[] args) {
//        String str = "Hello Java Hello Rocket";
//        String[] data1 = str.split(" ");//按空格将str拆分，拆到底
//        // 按照空格将str拆分，拆分后的字符串数组长度为2
//        String[] data2 = str.split(" ",2);//设置限制 2个
//        System.out.println(Arrays.toString(data1));
//        System.out.println(Arrays.toString(data2));



//        String[] data1 = ''str.split("-");
//        System.out.println(Arrays.toString(data1));
//        System.out.println(data1.length);

        // 拆分IP地址
        String str = "192.168.1.1";
        String[] data = str.split("\\.");
        System.out.println(Arrays.toString(data));
        System.out.println(".");
    }
}